package handler

import (
	"catering_sys_api/cmd/api/biz/business/model/user"
	"catering_sys_api/cmd/api/biz/business/service"
	"catering_sys_api/core/errno"
	"context"

	"github.com/cloudwego/hertz/pkg/app"
)

type UserHandler struct {
}

// 获取用户信息
func (p *UserHandler) Get(ctx context.Context, c *app.RequestContext) {
	var (
		response    user.GetResponse
		err         error
		userService *service.UserService
	)
	userService = service.NewUserService(ctx, c)
	response, err = userService.Get()

	if err != nil {
		errno.Fail(errno.DATA_NO_FUND, "", err.Error(), ctx, c)
		return
	}
	errno.Ok(response, "", ctx, c)

	return
}
